home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / filarry.exe / README.1ST < prev    next >
Text File  |  1993-04-16  |  3KB  |  66 lines

  1. XF2SF.exe -- convert your normal text string file to
  2.             "string data table file" (extension name .SDT)
  3. FILARRAY.H -- header file of class FileArray
  4. FILARRAY.CPP -- class FileArray implenmentation
  5.  
  6. The dilemma was posed by Richard Wesson(76701,46) is the following:
  7. " 'I have a very large program which I must compile in the LARGE model,
  8. because I have to link large model libraries, yet I am getting DGROUP
  9. EXCEEDS 64K error messages, because I have so many literal strings.
  10. What can I do?' "
  11.  
  12. The possible solutions are either place literal strings into far string
  13. variable or place literal strings into a text file.  However, either
  14. solution has its own drawback.
  15.  
  16. First, if we put into literal string into far string variable, it will
  17. take mem without doubt.  As we know mem is always a precious computer
  18. resource no matter what kind of environment, so putting literal strings
  19. into mem seems to be unwise.  Second, if we put literal strings into
  20. a normal text file, we encounter a speed problem.  How can we quickly
  21. retrieve any arbitrary string from a file?
  22.  
  23. xf2sf.exe and class FileArray may be the solution.
  24.  
  25. *.sdt file format:
  26. ______________________________
  27. |                            |
  28. |         HeadArea           |  head len = sizeof(SDTHEADER)
  29. |                            |
  30. |____________________________|
  31. |                            |
  32. |                            |
  33. |    String Context Area     |
  34. |                            |
  35. |                            |
  36. |                            |
  37. |                            |
  38. |____________________________|
  39. |                            |
  40. |                            |
  41. |   Offset Array Area        |
  42. |   (String Index Area)      |  offset array area len
  43. |                            |  = offsetArraySize * sizeof(long)
  44. |                            |  = num of string * sizeof(long)
  45. |                            |
  46. |____________________________|
  47.  
  48. the procedure is this:
  49. 1. put your literal string into a normal text file.
  50. 2. use xf2sf.exe convert your file to *.sdt file
  51. 3. in your source code you can use FileArray like this:
  52.  
  53.     // instanciate an object of class FileArray first
  54.     FileArray myfobj("mytest.sdt");
  55.     ...
  56.     // before some function may look like
  57.     abcFunc("this is test...", ...);
  58.     ...
  59.     // now the function may look like
  60.     abcFunc(myfobj[10], ...);
  61.  
  62. ( here as an example I assume the string "this is test..." is 10th
  63. string corresponding to your text file )
  64.  
  65. If you have any question send me CompuServe mail at 71162,1646 (Jian Hua)
  66.